Home:ALL Converter>Azure functions v3 VS2019/22 publish failing on Linux App with a Newtonsoft error

Azure functions v3 VS2019/22 publish failing on Linux App with a Newtonsoft error

Ask Time:2022-05-09T11:15:04         Author:Emil

Json Formatter

My azure functions is in .net core 3.1 v3 and I had a problem trying to publish using VS2019/22 on Linux app service but works fine if i choose Windows app service. I am not sure why it is complaning something about Newtonsoft.Json, I use the version 13.0.1 and It should be supported by Sdk version as well.

I have tried all possible bin, obj, nuget cache, temp to delete, restarted VS, ran VS in Admin mode but nothing helped.

Finally tried VS Code and publish went smooth. What is the deal here with VS unless there is bug was introduced. Because my last publish was at the end of the march with same project and I compared changes and even tried to back to a last published commit but still was same error. Any idea here?

Error I am getting

2>Uploaded the Zip file to the target.
2>Polling for deployment status...
2>The "ZipDeployTask" task failed unexpectedly.
2>System.AggregateException: One or more errors occurred. ---> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: {. Path 'build_summary', line 1, position 478.
2>   at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
2>   at Newtonsoft.Json.JsonTextReader.ReadAsString()
2>   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
2>   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
2>   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2>   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2>   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2>   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
2>   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
2>   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
2>   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
2>   at Microsoft.NET.Sdk.Functions.MSBuild.Tasks.ZipDeploymentStatus.<InvokeGetRequestWithRetryAsync>d__11`1.MoveNext()
2>--- End of stack trace from previous location where exception was thrown ---

Author:Emil,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/72166646/azure-functions-v3-vs2019-22-publish-failing-on-linux-app-with-a-newtonsoft-erro
AdaTheDev :

In case anyone else hits this issue and finds this Q....\nFull details of this bug are in: https://github.com/Azure/azure-functions-vs-build-sdk/issues/556\nThis has now been resolved in v4.1.1 of Microsoft.Net.Sdk.Functions, and also backported to v3.1.1. Updating the package ref in your Azure Function project should sort it.",
2022-06-09T08:10:27
yy